﻿package  {
	
	import flash.display.MovieClip;
	import base.BaseMc;
	import flash.events.MouseEvent;
	public class CheckBox extends BaseMc {
		
		
		public function CheckBox() {
			// constructor code
		}
		protected override function onInit():void {
			this.addEventListener(MouseEvent.CLICK,checkClick)
			
		}
		protected override function onRemove():void
		{
			this.removeEventListener(MouseEvent.CLICK,checkClick)
		}
		private function checkClick(e:MouseEvent):void
		{
			if(isChecked())
			{
				uncheck();
			}else
			{
				check();
			}
		}
		
		public function check():void
		{
			this.gotoAndStop(2);
		}
		public function uncheck():void
		{
			this.gotoAndStop(1);
		}
		public function isChecked():Boolean
		{
			return this.currentFrame==2; 
		}
		
		
	}
	
}
